<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="<?php echo site_url('js/jquery.js')?>"></script>
<script type="text/javascript" src="<?php echo site_url('js/checkfrm.js')?>"></script>
<title>抽奖管理后台</title>
<script type="text/javascript">
	function openwin(url)
	{
		window.location=''+url+'';
	}

	function submitfrm()
	{
		var price = $('#price').val();
		var singleprice = $('#singleprice').val();
		var maxnumber = $('#maxnumber').val();
		var infos = $('#infos').val();
		var beginDate = $('#beginDate').val();
		var endDate = $('#endDate').val();
		
		if(infos == '')
		{
			alert('活动名称不能为空');
			return false;
		}
		
		if(!checkprice(price))
		{
			alert('请正确填写:中奖金额');
			return false;
		}
		if(!checkprice(singleprice))
		{
			alert('请正确填写:单位金额');
			return false;
		}
		if(!checkint(maxnumber))
		{
			alert('请正确填写-最大可选数字');
			return false;
		}


		document.addreward.submit();
	}
</script>

<style>
body{background:#F4F4FF; font-size:14px; margin:auto}
.divScroll{     OVERFLOW:auto;
        scrollbar-face-color: #FFFFFF;
        scrollbar-shadow-color: #D2E5F4;
        scrollbar-highlight-color: #D2E5F4;
        scrollbar-3dlight-color: #FFFFFF;
        scrollbar-darkshadow-color: #FFFFFF;
        scrollbar-track-color: #FFFFFF; 
      	scrollbar-arrow-color: #D2E5F4;
	  }
</style>
<script type="text/javascript">
	function openwin(url)
	{
		window.location=''+url+'';
	}
</script>
</head>

<body topmargin="0">
<table width="1000px" border="0" cellpadding="0" bgcolor="#F4F4FF">
  <tr>
    <td width="235" height="37">&nbsp;</td>
    <td width="759">&nbsp;</td>
  </tr>
  <tr>
    <td height="30">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="485" align="center" valign="top">
<?php require_once 'left.php';?>
    </td>
    <td valign="top" align="center">
	
<form action="addreward" method="post" enctype="multipart/form-data" name="addreward">
<table width="100%" border="0" >


    <td><h3>添加奖项</h3></td>
  </tr>
  <tr>
    <td width="19%" height="31" align="left">活动信息:</td>
    <td width="81%" align="left"><label>
      <input  name="infos" value="<?=$reward['infos']; ?>" id="infos"/>
    (*)</label></td>
  </tr>
   <tr>
    <td width="19%" height="31" align="left">活动图片:</td>
    <td width="81%" align="left">
      <input type="file" name="rewardpic" id="fileField" />
       <input type="hidden" name="rewardpicold" id="fileField" value="<?=$reward['rewardpic']; ?>"/>       </td>
  </tr>
     <tr>
    <td width="19%" height="31" align="left">展示类型:</td>
    <td width="81%" align="left">
   
      <select name="showtype" id="select">
      <option value="1">文字</option>
      <option value="2">图片</option>
      </select>            </td>
  </tr>
  <tr>
    <td height="36" align="left">中奖金额:</td>
    <td align="left"><input  name="prices" value="<?=$reward['prices']?>" id="prices"/>
    (*)</td>
  </tr>
  
  <tr>
    <td height="35" align="left">奖品:</td>
    <td><!--<a href="javascript:addproduct();">[+]</a>  --></td>
  </tr>
   <!-- 
   <tr>
    <td height="35"></td>
    <td><input  name="products[]"/>
    (*)</td>
  </tr>
  -->
    <tr>
    <td height="35"></td>
    <td align="left">
    <?php 
	foreach($product as $key => $v){
		if(!empty($stock[$v['id']])){
	?>
    <li><?=$v['productname']?><input type="checkbox" name="product[]" value="<?=$v['id']?>" <?php  if(in_array($v['id'],$productarr)){?> checked<?php }?>/></li>
    <?php
		}
	 }
	 ?>
    </td>
  </tr>
  
 
  <tr>
    <td height="39" align="left">单位金额:</td>
    <td align="left"><input  name="singleprice" value="<?=$reward['singleprice']?>" id="singleprice"/><font color='red'>(不带货币符号)</font></td>
  </tr>
  <!-- 
  <tr>
    <td height="39" align="left">概率:</td>
    <td align="left"><input  name="probability" value="<?=$reward['probability'] ?>"/></td>
  </tr>
   
    <tr>
    <td height="39" align="left">最小可选数字:</td>
    <td align="left"><input  name="minnumber" value="<?=$reward['minnumber'] ?>" size="20"/></td>
  </tr>
  -->
      <tr>
    <td height="39" align="left">最大可选数字:</td>
    <td align="left"><input  name="maxnumber" value="<?=$reward['maxnumber'] ?>" size="20" id="maxnumber"/><font color='red'>(大于1的整数)</font></td>
  </tr>
  <!-- 
        <tr>
    <td height="39" align="left">开始时间:</td>
    <td align="left"><input type="text" name="beginDate" value="<?=$reward['beginDate']?>"></td>
  </tr>
        <tr>
    <td height="39" align="left">结束时间:</td>
    <td align="left"><input  name="endDate" value="<?=$reward['endDate']?>" size="20"/></td>
  </tr>
 -->
      <tr>
    <td height="39" align="left">状态：</td>
    <td align="left">
           <select name="enabled">
      	<option value="0" <?php if($reward['enabled'] == 0){?> selected<?php } ?>>停止</option>
      	<option value="1" <?php if($reward['enabled'] == 1){?> selected<?php } ?>>启动</option>
      	<option value="2" <?php if($reward['enabled'] == 2){?> selected<?php } ?>>已结束</option>
      </select>    </td>
  </tr>
  <tr>
    <td height="44" align="left">备注：</td>
    <td align="left">
    <textarea name="content" cols="40" rows="10" id="textarea"><?=$reward['content'] ?></textarea>   </td>
  </tr>
    <tr>
    <td height="44">&nbsp;</td>
    <td>
    <input type="hidden" name="rewardnumold" value="<?=$reward['rewardnum'] ?>" />
    <input type="hidden" name="id" value="<?=$reward['id']?>"/>
      <input type="submit" name="Submit" value="提交" />
    </td>
  </tr>
</table>
</form>

    
    </td>
  </tr>
</table>
</body>
</html>
